﻿using System;
using System.Diagnostics;
using System.Windows.Forms;

namespace Toolbox
{
    static class Program
    {
        /// <summary>
        /// 应用程序的主入口点。
        /// </summary>
        [STAThread]
        static void Main()
        {
            if (IsRunning())
            {
                return;
            }

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            Application.Run(new HomeForm());
            //Application.Run(new MainForm());
        }

        static bool IsRunning()
        {
            bool result = false;

            Process currentProcess = Process.GetCurrentProcess();
            foreach (Process p in Process.GetProcesses())
            {
                if (p.Id == currentProcess.Id)
                {
                    continue;
                }

                if (p.ProcessName == currentProcess.ProcessName)
                {
                    result = true;
                    break;
                }
            }

            return result;
        }
    }
    
}
